fstats_levenberg_marquardt Module



Variables

Type Visibility Attributes Name Initial
integer(kind=int32), public, parameter :: FS_LEVENBERG_MARQUARDT_UPDATE = 1
integer(kind=int32), public, parameter :: FS_NIELSEN_UPDATE = 3
integer(kind=int32), public, parameter :: FS_QUADRATIC_UPDATE = 2

Derived Types

type, public ::  lm_solver_options

Options to control the Levenberg-Marquardt solver.

Components

Type Visibility Attributes Name Initial
real(kind=real64), public :: damping_decrease_factor

The factor to use when decreasing the damping parameter.

real(kind=real64), public :: damping_increase_factor

The factor to use when increasing the damping parameter.

real(kind=real64), public :: finite_difference_step_size

The step size used for the finite difference calculations of the Jacobian matrix.

integer(kind=int32), public :: method

The solver method to utilize. - FS_LEVENBERG_MARQUARDT_UPDATE: - FS_QUADRATIC_UPDATE: - FS_NIELSEN_UDPATE:

Type-Bound Procedures

procedure, public :: set_to_default => lm_set_default_settings

Subroutines

public subroutine nonlinear_least_squares(fun, x, y, params, ymod, resid, weights, maxp, minp, stats, alpha, controls, settings, info, status, cov, args)

Performs a nonlinear regression to fit a model using a version of the Levenberg-Marquardt algorithm.

Arguments

Type IntentOptional Attributes Name
procedure(regression_function), intent(in), pointer :: fun

A pointer to the regression_function to evaluate.

real(kind=real64), intent(in) :: x(:)

The M-element array containing independent data.

real(kind=real64), intent(in) :: y(:)

The M-element array containing dependent data.

real(kind=real64), intent(inout) :: params(:)

On input, the N-element array containing the initial estimate of the model parameters. On output, the computed model parameters.

real(kind=real64), intent(out) :: ymod(:)

An M-element array where the modeled dependent data will be written.

real(kind=real64), intent(out) :: resid(:)

An M-element array where the model residuals will be written.

real(kind=real64), intent(in), optional, target :: weights(:)

An optional M-element array allowing the weighting of individual points.

real(kind=real64), intent(in), optional, target :: maxp(:)

An optional N-element array that can be used as upper limits on the parameter values. If no upper limit is requested for a particular parameter, utilize a very large value. The internal default is to utilize huge() as a value.

real(kind=real64), intent(in), optional, target :: minp(:)

An optional N-element array that can be used as lower limits on the parameter values. If no lower limit is requested for a particalar parameter, utilize a very large magnitude, but negative, value. The internal default is to utilize -huge() as a value.

type(regression_statistics), intent(out), optional :: stats(:)

An optional N-element array that, if supplied, will be used to return statistics about the fit for each parameter.

real(kind=real64), intent(in), optional :: alpha

The significance level at which to evaluate the confidence intervals. The default value is 0.05 such that a 95% confidence interval is calculated.

type(iteration_controls), intent(in), optional :: controls

An optional input providing custom iteration controls.

type(lm_solver_options), intent(in), optional :: settings

An optional input providing custom settings for the solver.

type(convergence_info), intent(out), optional, target :: info

An optional output that can be used to gain information about the iterative solution and the nature of the convergence.

procedure(iteration_update), intent(in), optional, pointer :: status

An optional pointer to a routine that can be used to extract iteration information.

real(kind=real64), intent(out), optional, dimension(:,:) :: cov

An optional N-by-N matrix that, if supplied, will be used to return the covariance matrix, computed from an SVD of the final weighted Jacobian. Rank diagnostics are available in info when requested.

class(*), intent(inout), optional :: args

An optional argument allowing the passing in/out of data for the fun routine.